/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.store;

import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import oracle.jdbc.OracleTypes;
import queenb.net.datacontrol.DataStatement;
import queenb.net.datacontrol.Param;
import queenb.net.entitybean.N000;
import queenb.net.entitybean.N300;
import queenb.web.util.PackageContants;

/**
 *
 * @author Nguyen Hung
 */
public class N300Store extends N300 {

    public List<N300> getListN300R(int pnFH000, int pnFH200, int pnFN450, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_N300R, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFN450),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.find(dataStatement, N300.class);
    }

    public List<N300> getListN300L(int pnFH000, int pnFH200, int pnFN450, String pvLOGIN) throws SQLException, InstantiationException, IllegalAccessException {
        DataStatement dataStatement = new DataStatement(PackageContants.LIST_N300L, OracleTypes.CURSOR, new Param[]{
                    new Param(OracleTypes.INTEGER, pnFH000),
                    new Param(OracleTypes.INTEGER, pnFH200),
                    new Param(OracleTypes.INTEGER, pnFN450),
                    new Param(OracleTypes.CHAR, pvLOGIN)
                });
        return super.find(dataStatement, N300.class);
    }
    
    public int updateN300(int pnPN450, int pnPN850, String pvNV852, String pvNV303, Date pdND304, Date pdND305, String pvLOGIN) {
        try {
            DataStatement updateStatement = new DataStatement(PackageContants.UPDATE_N300, OracleTypes.INTEGER, new Param[]{
                        new Param(OracleTypes.INTEGER, pnPN450),
                        new Param(OracleTypes.INTEGER, pnPN850),
                        new Param(OracleTypes.CHAR, pvNV852),
                        new Param(OracleTypes.CHAR, pvNV303),
                        new Param(OracleTypes.DATE, pdND304),
                        new Param(OracleTypes.DATE, pdND305),
                        new Param(OracleTypes.CHAR, pvLOGIN)});
            return super.update(updateStatement, N300.class);
        } catch (SQLException ex) {
            Logger.getLogger(N300Store.class.getName()).log(Level.SEVERE, null, ex);
            return 0;
        }
    }
}
